<?php
	/**
		Main page that handles all other pages.
		
		@author Joseph Fehrman
	*/
	$pageToLoad="Chat Client";
	if(isset($_GET['page'])){
		$pageToLoad = $_GET['page'];
	}
	if(!isset($_COOKIE['username'])){
		if($_GET['page'] != "login"){
			header("Location: ./index.php?page=login");
		}
	}
	if($pageToLoad == "Chat Client" || $pageToLoad == "Chat Client"){
		header('Location: ./index.php?page=chat');
	}else if($pageToLoad == "chat"){
		include_once("./chatClient.php");
	}else if($pageToLoad == "login"){
		include_once("./login.php");
	}else if($pageToLoad == "register"){
		include_once("./register.html");
	}else{
		header('Loaction: ./index.php?page=chat');
	}
?>
<head>
	<title><?php echo $pageToLoad; ?></title>
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
	<?php if($pageToLoad == "chat"){ ?> 
		<script src="./js/chat.js"></script>
		<script src="./js/chatClient.js"></script>
		<link rel="stylesheet" type="text/css" href="./css/chat.css" />
	<?php } ?>
<head>